package com.tairan.chapter.nacos.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class TairanSpringCloudNacosConfigApplication {

	static Logger logger = LoggerFactory.getLogger(TairanSpringCloudNacosConfigApplication.class);

	public static void main(String[] args) throws Exception {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(TairanSpringCloudNacosConfigApplication.class, args);

		/*while (true) {
			//当动态配置刷新时，会更新到 Enviroment中，因此这里每隔一秒中从Enviroment中获取配置
			ConfigurableEnvironment environment = applicationContext.getEnvironment();
			String name = environment.getProperty("tairan.name");
			String age = environment.getProperty("tairan.age");
			logger.info("配置信息，名称：{}，年龄：{}", name, age);
			TimeUnit.SECONDS.sleep(1);
		}*/
	}

}
